<!DOCTYPE html>
<html lang="en">
	<head>
    	<meta name="layout" content="main_mobile">
        <title>火堆</title>       
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'donate_list_2.0.css')}" type="text/css">
        <script type="text/javascript" src="${resource(dir: 'js', file: 'jquery-1.10.2.js')}" ></script>  
    </head>
<body>

	<section class="ui-container">
        <div class="ui-line ui-border-b">
            <p>感谢<em>${subProjectSize}</em> 位爱心伙伴参与一起捐</p>
        </div>
        <ul id="normal" class="ui-list ui-border-b sf style1 ">
        	<%--<g:each in="${subProject.donates}" var="donate">
            <li class="ui-border-t">
                <div class="date"><g:formatDate format="MM-dd HH:mm" date="${donate.date}"/></div>
                <div class="ui-box">
                    <div class="ui-avatar">
                        <g:if test="${donate.member.headimgurl!=null}">
			                			<span style="background-image:url(${donate.member.headimgurl})"></span>
			                	</g:if>
			                	<g:elseif test="${donate.member.headimgurl==null}">
			                			<span style="background-image:url(${resource(dir:'images/demo',file:'demo-avatar-1.jpg')})"></span>
			                	</g:elseif>
                    </div>
                    <div class="ui-list-info">
                        <h4 class="ui-nowrap">${donate.member.nickname}</h4>
                        <p class="ui-nowrap">支持了<em>${donate.donate_fee}</em>元
                        <g:if test="${fRuler!=null}">
                          <g:if test="${donate?.fDonate?.donate_fee}">
                                              ，配捐
                        <em><g:formatNumber number="${donate?.fDonate?.donate_fee/100}" format="0.00"/> </em>元
                        </g:if>
                        </g:if>
                        </p>
                    </div>
                </div>
                <div class="ui-box">
                    <p>${donate.comment?.text}</p>
                </div>
            </li>
            </g:each>
        --%></ul>
         <div class="ui-line more"><p id="week" style="" onclick='' >点击加载更多</p></div>
<%--        <div class="banner-wrap">--%>
<%--             <div class="txt-bottom">--%>
<%--            <a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzAxNjM5NzExOQ==&hid=3&sn=e498fbdd2e826943340c0729061ac868#wechat_redirect">了解火堆</a>--%>
<%--            <a href="/scfire/project/qrcode">关注火堆</a><img src="../images/ic-qrcode.png" alt="">--%>
<%--            </div>--%>
<%--            <img class="img-bottom" src="../images/logo_and_txt.png" alt="" class="ui-introduction">--%>
<%--        </div>--%>
        
        
        
        
        <script type="text/javascript">
        var finalOffset= 20
        var offset = 0
	ajaxRead();
    function ajaxRead(){
        var html="";  
    	$.ajax({  
            type:'get',  
            dataType:'json',
            url:'/scfire/donate/donateThanks2?format=json&offset='+ offset+'&subprojectId='+${subprojectId},  		           
            beforeSend:function(){console.log('loading...');$("#week").html('加载中...');},  
            success:function(data){
          	  $.each(data,function(i,item){
          		offset++
          		//console.log(item)
          		html+="<li class='ui-border-t'>"
          		html+="<div class='date'>"+item.date+"</div>"
          		html+="<div class='ui-box'>" 
          		html+="<div class='ui-avatar'>"
                if(item.headimgurl!=null){
                	html+="<span style='background-image:url("+item.headimgurl+")'></span>"
                }else if(item.headimgurl==null){
                	html+="<span style='background-image:url(../images/demo/demo-avatar-1.jpg)'></span>"
                }
          		html+="</div>"
              		
          		html+="<div class='ui-list-info'>"
              		if(null==item.nickname){
              		html+="<h4 class='ui-nowrap'>爱心天使</h4>"
                  	}
                  	else{
                  		html+="<h4 class='ui-nowrap'>"+csubstr(item.nickname,8)+"</h4>"
                      	}
          		
          		if(item.fDonatemoney == 0){
          			html+="<p class='ui-nowrap'>已捐<em>"+item.money.toFixed(2)+"</em>元</p>"
          		}else{
          			html+="<p class='ui-nowrap'>已捐<em>"+item.donate_fee.toFixed(2)+"</em>元， 配捐<em>"+item.fDonatemoney.toFixed(2)+"</em>元</p>"
          		}
          		html+="</div>"
          		html+="</div>"
          		html+="<div class='ui-box'>"
          		if(item.text !=null){
              		html+="<p class='ui-txt-sub'>"+item.text+"</p>"
              	}
          		html+="</div>"
          		html+="</li>"
          	  });
          	  
          	  //html += "<div class="ui-line more"><p id="week" style=""  onclick="ajaxRead();">点击加载更多</p></div>"
	          //$("#week").remove();
              $("#normal").append($(html));
              if(data.length<finalOffset){       				
  				$("#week").html("已经到底了")
  				$("#week").removeAttr("onclick");
  				
      		}else{
      			
 	            $("#week").html("加载更多")
 	            $("#week").attr("onclick","ajaxRead()");
          		}
            },  
            complete:function(){console.log('mission complete.')} ,
            error:function(data){
          	  $("#week").html('已经到底了');
            }
           
      });
       }


    function csubstr(str,len){
      	 if(str.length>9){
      	  return str.substring(0,len)+"...";
      	 }else{
      	  return str;
      	 }
      	}
 </script>

</body>










</html>